package sqldb

type WhereClause struct {
	AndOr string
	Key string
	Op string
	Value interface{}
}

// Cond 条件
type Cond struct{
	Clauses []WhereClause
}

func (t *Cond) Reset() *Cond {
	t.Clauses = make([]WhereClause, 0)
	return t
}

func (c *Cond) add(andOr string, key string, op string, value interface{}) *Cond {
	c.Clauses = append(c.Clauses, WhereClause{
		andOr,
		key,
		op,
		value,
	})
	return c
}

func (c *Cond) And(key string, op string, value interface{}) *Cond {
	return c.add("AND", key, op, value)
}

func (c *Cond) Or(key string, op string, value interface{}) *Cond {
	return c.add("OR", key, op, value)
}
